package com.cate.controller.user;

import com.cate.constants.RedisConstant;
import com.cate.result.RestResponse;
import com.cate.utils.RedisUtil;
import com.cate.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @CreateTime: 2023/8/1
 * @Author: <==lhd==>
 * @Description:
 */

@RestController("UserShopController")
@Slf4j
@RequestMapping("/user/shop")
@Api(tags = "用户端店铺接口")
public class ShopController {
    @Autowired
    private RedisUtil redisUtil;

    @GetMapping("/status")
    @ApiOperation("获取营业状态")
    public RestResponse<Integer> getStatus() {
        String redisStatus = redisUtil.get(RedisConstant.SHOP_STATUS_KEY);
        log.info("获取营业状态={}", redisStatus);
        return ResultUtil.success(Integer.valueOf(redisStatus));
    }
}
